# binary_to_dna.py

# Creates a function that maps a 2-bit binary string to DNA bases
def binary_to_dna(binary_str):
    """Convert binary string to DNA sequence using 2-bit mapping."""
    mapping = {
        '00': 'A',
        '01': 'T',
        '10': 'C',
        '11': 'G'
    }

    # Remove spaces if binary has them
    binary_str = binary_str.replace(" ", "")
    
    # Pad binary string to make its length a multiple of 2
    if len(binary_str) % 2 != 0:
        binary_str += '0'

    dna_seq = ''
    for i in range(0, len(binary_str), 2):
        pair = binary_str[i:i+2]
        dna_seq += mapping[pair]
    
    return dna_seq

# Prompt user to enter a binary string via the console, runs it through the function, and prints out the resulting DNA strand.
if __name__ == "__main__":
    binary_input = input("Enter binary code to convert to DNA: ")
    dna_output = binary_to_dna(binary_input)

    print("\nDNA Sequence:")
    print(dna_output)